﻿using System.Collections.Generic;
using Firefly.Framework.Windows;
using Firefly.Framework.Windows.ContentReaders;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler;

namespace Firefly.ContentPipeline.Windows
{
    [ContentTypeWriter]
    public class ThemePartContentWriter : ContentTypeWriter<ThemePart>
    {
        protected override void Write(ContentWriter output, ThemePart value)
        {
            WriteThemePart(output, value);
        }

        public override string GetRuntimeReader(TargetPlatform targetPlatform)
        {
            return typeof(ThemePartContentReader).AssemblyQualifiedName;
        }

        internal static void WriteThemePart(ContentWriter output, ThemePart value)
        {
            output.Write(value.AssetName);
            output.WriteObject<Dictionary<string, Rectangle>>(value.Rectangles);
            output.WriteObject<Vector4>(value.ClientAreaOffset);
            output.WriteObject<Vector4>(value.TextOffset);
            output.WriteObject<Point>(value.MinimumSize);
        }
    }
}
